package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.system.mapper.TbBookCategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TbBookinfoMapper;
import com.ruoyi.system.domain.TbBookinfo;
import com.ruoyi.system.service.ITbBookinfoService;

/**
 * 图书信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-16
 */
@Service
public class TbBookinfoServiceImpl implements ITbBookinfoService 
{
    @Autowired
    private TbBookinfoMapper tbBookinfoMapper;

    @Autowired
    private TbBookCategoryMapper tbBookCategoryMapper;

    /**
     * 查询图书信息
     * 
     * @param bookId 图书信息主键
     * @return 图书信息
     */
    @Override
    public TbBookinfo selectTbBookinfoByBookId(Long bookId)
    {
        return tbBookinfoMapper.selectTbBookinfoByBookId(bookId);
    }

    /**
     * 查询图书信息列表
     * 
     * @param tbBookinfo 图书信息
     * @return 图书信息
     */
//    @Override
//    @DataScope(categoryAlias ="ca", bookinfoAlias = "b")
//    public List<TbBookinfo> selectTbBookinfoList(TbBookinfo tbBookinfo)
//    {
//        return tbBookinfoMapper.selectTbBookinfoList(tbBookinfo);
//    }
    @Override
    @DataScope(categoryAlias ="ca", bookinfoAlias = "b")
    public List<TbBookinfo> selectTbBookinfoList(TbBookinfo tbBookinfo)
    {
        return tbBookinfoMapper.selectTbBookinfoList(tbBookinfo);
    }

    /**
     * 新增图书信息
     * 
     * @param tbBookinfo 图书信息
     * @return 结果
     */
    @Override
    public int insertTbBookinfo(TbBookinfo tbBookinfo)
    {
        return tbBookinfoMapper.insertTbBookinfo(tbBookinfo);
    }

    /**
     * 修改图书信息
     * 
     * @param tbBookinfo 图书信息
     * @return 结果
     */
    @Override
    public int updateTbBookinfo(TbBookinfo tbBookinfo)
    {
        return tbBookinfoMapper.updateTbBookinfo(tbBookinfo);
    }

    /**
     * 批量删除图书信息
     * 
     * @param bookIds 需要删除的图书信息主键
     * @return 结果
     */
    @Override
    public int deleteTbBookinfoByBookIds(Long[] bookIds)
    {
        return tbBookinfoMapper.deleteTbBookinfoByBookIds(bookIds);
    }

    /**
     * 删除图书信息信息
     * 
     * @param bookId 图书信息主键
     * @return 结果
     */
    @Override
    public int deleteTbBookinfoByBookId(Long bookId)
    {
        return tbBookinfoMapper.deleteTbBookinfoByBookId(bookId);
    }
}
